<?php

// +++++ database connection data +++++

$hn =		"localhost";				// define hostname
$db =		"geolocalip"; 				// define database name
$dbuser =	"root"; 					// user
$dbpass =	"root"; 				// password


// +++++ database connection functions +++++

function dbconnect() {
	global $hn, $db, $con, $errormsg, $dbpass, $dbuser;
	$con = @mysql_connect($hn, $dbuser, $dbpass);
	$db_sel = @mysql_select_db($db, $con);
	if (!$db_sel) {
		dbconnectdev();
	}
}

function dbconnectdev() {
	global $hn, $db, $con, $errormsg, $dbpass, $dbuser;
	$con = @mysql_connect($hn);
	$db_sel = @mysql_select_db($db, $con);
	if (!$db_sel) {
		echo "could not connect to database $db ! please go back and try again.";
		exit;
	}
}

function dbclose() {
	global $con;
	mysql_close($con);
}

?>